package io.kiki.sba.registry.server.shared.meta;

import io.kiki.sba.registry.common.model.ClientInterfaceId;
import io.kiki.sba.registry.common.model.metaserver.FetchSystemPropertyResult;
import io.kiki.sba.registry.common.model.metaserver.ProvideData;
import io.kiki.sba.registry.common.model.metaserver.SlotsChangeEvent;
import io.kiki.sba.registry.common.model.metaserver.nodes.ClientInterfaceNode;
import io.kiki.sba.registry.common.model.slot.SlotsStatusResponse;

import java.util.List;
import java.util.Map;
import java.util.Set;


public interface MetaServerService {

    void startRenewer();


    void suspendRenewer();


    void resumeRenewer();

    /**
     * update data server expireTime
     */
    boolean renewNode();


    boolean handleSlotsChange(SlotsChangeEvent event);


    ProvideData getProvideData(String dataInfoId);

    Map<String, ProvideData> getProvideData(Map<String, Long> dataInfoIdsWithVersion);

    /**
     * Add self to meta blacklist.
     */
    void addSelfToMetaBlacklist();

    /**
     * Remove self from meta blacklist.
     */
    void removeSelfFromMetaBlacklist();

    /**
     * @param zonename zone is null, get all session
     */
    List<String> getSessionServerList(String zonename);

    List<ClientInterfaceNode> getSessionNodeWithConnNumList(String zonename);

    Set<ClientInterfaceId> getClientInterfaceIdSet();


    Set<String> getDataServerList();

    String getMetaServerLeader();


    long getSessionServerEpoch();


    Set<String> getDataCenters();

    FetchSystemPropertyResult fetchSystemProperty(String dataInfoId, long currentVersion);

    SlotsStatusResponse getSlotsStatus();
}
